<template>
    <div class="iframe">
        <div class="i-title">
            <h3>异步加载组件</h3>
        </div>
        <div class="i-tip">{{ sum }}</div>
    </div>
</template>

<script>
import {
    ref
} from "vue";
export default {
    name: "TodoList",
    async setup() {
        const sum = ref(0);
        const rawData = await new Promise((resolve, reject) => {
            setTimeout(() => {
                resolve(sum);
            }, 3000);
            if (sum.value != 0) {
                setTimeout(() => {
                    reject(sum);
                }, 3000);
            }
        });
        return {
            sum
         }
    }
}
</script>

